<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateEssayTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        // 创建数据表
        Schema::create('essay', function ($table) {
            
            $table->increments('id');
            $table->integer('user_id');
            $table->longText('description');
            $table->json('image_ids');
            $table->tinyInteger('type');
            
            $table->tinyInteger('view_count');
            $table->tinyInteger('favorite_count');
            $table->tinyInteger('love_count');
            $table->tinyInteger('comment_count');
            
            $table->tinyInteger('top');
            $table->tinyInteger('recommend');
            $table->boolean('status');
            
            $table->softDeletes();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        // 删除数据表
        Schema::dropIfExists('essay');
    }
}
